﻿@model IEnumerable<trangbaocao.Models.Main_Sort_DeviceModel>        
<!--Body-->
<div align="center"><h1>DANH MỤC HỆ THỐNG VIỄN THÔNG</h1></div>
<div class="container_12">
    <div class="grid_12">
        <!-- Notification boxes -->
        @if (TempData["msg"] != null)
        {                            
            <span class="notification n-success">@TempData["msg"]</span>
        }
        @if (TempData["error"] != null)
        {                            
            <span class="notification n-error">@TempData["error"]</span>
        } 
        <div class="bottom-spacing">
            <!-- Button -->
            <div class="float-right">
                <a href="@Url.Action("AddMain_Sort_Device","Main_Sort_Device")" class="button">
                    <span>Thêm mới <img src="@Url.Content("~/Content/Body/Images/plus-small.gif")"  width="12" height="9" alt="Thêm mới" /></span>
                </a>
            </div>    
        </div>   
        
        @using (Html.BeginForm("CheckedAction", "Main_Sort_Device", FormMethod.Post, new { id = "CheckedAction", name = "CheckedAction" }))
        {           
            <div class="module">
                <h2><span>@*Sample table*@</span></h2>                    
                <div class="module-table-body">
                    <div class="scrolling">
                        <div class="data-table" style="width:100%">
                            <table id="myTable" class="tablesorter">
                                <thead>
                                    <tr>
                                        <th style="width:40px;">STT</th>
                                        <th style="width:50px;">Chọn</th>
                                        <th style="width:40px;">Xóa</th>
                                        <th style="width:40px;">Sửa</th>
                                        <th >Tên</th>
                                        <th >Ghi chú</th>
                                        
                                    </tr>
                                </thead>
                            <tbody>
                        @{int stt = 0;}
                        @foreach (var item in Model)
                        {
                            stt++;
                            <tr>
                                <td class="align-center">@stt</td>
                                <td class="align-center"><input type="checkbox" name="Items" id="Items[]" value="@item.id"/></td>
                                <td class="align-center">
                                    <a href="@Url.Action("DeleteMain_Sort_Device", "Main_Sort_Device", new { id = item.id })" onclick="return confirm('Bạn muốn xóa thông tin này?');" title="Xóa thông tin"><img src="@Url.Content("~/Content/Body/Images/cross-on-white.gif")" width="16" height="16" alt="delete" /></a>&nbsp;&nbsp;&nbsp;                                    	
                                    @*<a href="" title=""><img src="../../Content/Body/Images/tick-circle.gif"  width="16" height="16" alt="published" /></a>*@
                                </td>
                                <td class="align-center">    
                                    <a href="@Url.Action("EditMain_Sort_Device", "Main_Sort_Device", new { id = item.id })" title="Sửa thông tin"><img src="@Url.Content("~/Content/Body/Images/pencil.gif")"  width="16" height="16" alt="edit" /></a>&nbsp;&nbsp;&nbsp;
                                    @*<a href=""><img src="../../Content/Body/Images/balloon.gif" width="16" height="16" alt="comments" /></a>*@
                                    
                                </td>
                                
                                
                                @*<td class="align-center"><input type="checkbox" name="Items" id="Items[]" value="@item.user_name"/></td>*@
                                
                                <td> @Html.DisplayFor(modelItem => item.name)</td>
                                <td> @Html.DisplayFor(modelItem => item.ghi_chu)</td>                                    
                                
                            </tr>
                        }   
                        </tbody>
                        
                        </table>
                    </div>
                   </div> <!-- End data-table--> 
                    <div class="pager" id="pager">
                        <div>
                        <img class="first" src="@Url.Content("~/Content/Body/Images/arrow-stop-180.gif")"  alt="first"/>
                        <img class="prev" src="@Url.Content("~/Content/Body/Images/arrow-180.gif")" alt="prev"/> 
                        <input type="text" class="pagedisplay input-short align-center"/>
                        <img class="next" src="@Url.Content("~/Content/Body/Images/arrow.gif")" alt="next"/>
                        <img class="last" src="@Url.Content("~/Content/Body/Images/arrow-stop.gif")" alt="last"/>
                        <select class="pagesize input-short align-center">
                            <option value="20" selected="selected">20</option>
                            <option value="30">30</option>
                            <option value="40">40</option>
                        </select>
                        </div>
                    </div>
                    <div class="table-apply"> 
                        <div class="float-right">
                            <a style='cursor:pointer' onclick="return CheckItem();" class="button">
                                <span>Xóa chọn</span>
                            </a>
                        </div>                  
                                              
                    </div>
                    <div style="clear: both"></div>
               
                </div> <!-- End .module-table-body -->
            </div> <!-- End .module --> 
        }                                                                    
	</div> <!-- End .grid_12 -->            
    <div style="clear:both;"></div>            
</div> <!-- End .container_12 -->
<!----------------------------------------------------------------->
<script language="javascript" type="text/javascript">
    function CheckItem() {
        var arrCheckboxes = document.getElementsByName('Items');
        var checkCount = 0;
        for (var i = 0; i < arrCheckboxes.length; i++) {
            checkCount += (arrCheckboxes[i].checked) ? 1 : 0;
        }
        if (checkCount > 0) {
            if (confirm("Bạn chắc chắn muốn xóa thông tin đã chọn?"))
                document.forms["CheckedAction"].submit();
        } else {
            alert("Bạn chưa chọn thông tin cần xóa!");
            return false;
        }
    }
</script>

    

           

	